<template>
  <main class="content">
    <header><van-icon name="arrow-left" @click="back" /> <span>{{ title }}</span></header>
    <div class="list">
      <van-swipe-cell>
        <div class="list-item" v-for="item in list" :key="item.id">
          <van-icon name="column" class="icon-style" />
          <div class="list-item-right">
            <div class="list-item-info">
              <span>关于上海雍禾爱慕门诊部有限公司</span>
              <span>刚刚</span>
            </div>
            <p>经查，2020年11月12日，当事人在新氧网网店智美颜</p>
          </div>
        </div>
        <template #right>
          <van-button @click="deleteItem(item.id)" square text="删除" type="danger" class="delete-button" />
        </template>
      </van-swipe-cell>
    </div>
  </main>
</template>
<script setup>
import {
  chatSessionCollectList,
  chatSessionUncollect
} from "@/api";
import { onMounted } from "vue";
import { showNotify } from 'vant'

const router = useRouter()
const route = useRoute()
const title = ref("违法行为识别")
const list = ref([{}])
const back = () => {
  router.go(-1)
}
function deleteItem(id) {
  chatSessionUncollect({
    id
  }).then(res => {
    if (res.code == 0) {
      showNotify({ type: 'success', message: '删除成功' })

    }
  })
}
function getChatSessionCollectList() {
  chatSessionCollectList({
    type: "0"
  }).then(res => {
    if (res.code == 0) {

    }
  })
}
onMounted(() => {
  if (route.query.type == "2") {
    title.value = "行政处罚建议"
  }
  getChatSessionCollectList()
})
</script>
<style lang="scss" scoped>
.content {
  padding: 0 20px;

  header {
    display: flex;
    align-items: center;
    font-size: 20px;
    font-weight: 600;
    height: 60px;

    span {
      display: flex;
      align-items: center;
      margin: auto;
    }
  }

  .list {
    .list-item {
      display: flex;
      margin-bottom: 20px;
      color: #666;

      .icon-style {
        padding: 4px;
        font-size: 28px;
        border-radius: 4px;
        color: #1471f4;
        background: #d4e5fc;
      }

      .list-item-right {
        width: 80%;
        display: inline-block;
        margin-left: 20px;

        .list-item-info {
          display: flex;
          justify-content: space-between;

          span:nth-child(1) {
            width: 70%;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
          }
        }

        p {
          width: 100%;
          overflow: hidden;
          white-space: nowrap;
          text-overflow: ellipsis;
          margin: 0;
        }
      }
    }
  }
}
</style>
